var setInter
Page({
  data: {
    //存储计时器
   
    num: 0,
  },
  onLoad: function () {
    var that = this;

  },
  startSetInter: function () {
    var that = this;
    //将计时器赋值给setInter
    setInter = setInterval(function () {
      that.setData({
        num: that.data.num+1,
      })
    }, 1000);
  },
  endSetInter: function () {
    clearInterval(setInter)
  },
  onHide: function () {

  },
  onUnload: function () {
    //清除计时器  即清除setInter
    clearInterval(setInter)
  },

})